package xyz.xtt.asset.support;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import xyz.xtt.pay.api.enums.PayOrderBusinessTypeEnum;
import xyz.xtt.pay.service.BusinessOrderOperator;

/**
 * @author dale
 * @date 2025/3/14
 **/
@Component
public class BusinessOrderOperatorFactory {
	@Autowired
	private List<BusinessOrderOperator> operators;

	public BusinessOrderOperator getOperator(PayOrderBusinessTypeEnum type) {
		return operators.stream().filter(orderOperator -> orderOperator.canOperateType(type)).findFirst().orElse(null);
	}
}
